package com.kyg.tjtoolmanager.module;

import com.alibaba.fastjson.annotation.JSONField;

/**
 * 物品信息
 * id,图片，名称，位置，数量
 */
public class Goods {

    public int index;
    @JSONField(name = "ID")
    public int id;
    @JSONField(name = "NAME")
    public String name;
    @JSONField(name = "CODE_NUM")
    public String code_num;
    @JSONField(name = "SIGN_NUM")
    public String sign_num;  //自主编码

    @JSONField(name = "KIND_ID")
    public String kind_id;  //分类id

    @JSONField(name = "SPEC")
    public String spec;     //规格型号

    @JSONField(name = "REMARK")
    public String remark;

    @JSONField(name = "STATUS")
    public String status; //状态 -1待绑定 1在库0领用 2维修 3报废 4出库 5待入库
    @JSONField(name = "PICTURE")
    public String picture;      //图片 base64位
    @JSONField(name = "LOCKED")
    public String locked;       //冻结状态 0解冻 1冻结

    @JSONField(name = "KIND_NAME")
    public String kind_name;      //分类名称

    @JSONField(name = "WAREHOUSE_NAME")
    public String house_name;       //库房名称

    @JSONField(name = "SHELVES_NAME")
    public String shelves_name;     //货位名称

    @JSONField(name = "TOOLBOX_NAME")
    public String toolbox_name;     //工具箱名称


    public String getNumber() {
        return "标签号：" + code_num + "\n编号：" + sign_num;
    }

    public String getAddress() {
        return "库房名称：" + house_name + "\n货架名称：" + shelves_name + "\n工具箱名称：" + toolbox_name;
    }

    public String getGoodsStatus() {
        String _status = "未知";
        if (status == null || locked == null) {
            return _status;
        }
        if (status == "-1") {
            _status = "待绑定";
        } else if (status == "0") {
            _status = "领用";
        } else if (status == "1") {
            _status = "在库";
        } else if (status == "2") {
            _status = "维修";
        } else if (status == "3") {
            _status = "报废";
        } else if (status == "4") {
            _status = "出库";
        } else if (status == "5") {
            _status = "待入库";
        }
        _status += " ";
        if (locked == "1") {
            _status += "解冻";
        } else if (locked == "0") {
            _status += "解冻";
        }
        return _status;
    }


    @Override
    public String toString() {
        return "Goods{" +
                "index=" + index +
                ", id=" + id +
                ", name='" + name + '\'' +
                ", code_num='" + code_num + '\'' +
                ", sign_num='" + sign_num + '\'' +
                ", kind_id='" + kind_id + '\'' +
                ", spec='" + spec + '\'' +
                ", remark='" + remark + '\'' +
                ", status='" + status + '\'' +
                ", picture='" + picture + '\'' +
                ", locked='" + locked + '\'' +
                ", kind_name='" + kind_name + '\'' +
                ", house_name='" + house_name + '\'' +
                ", shelves_name='" + shelves_name + '\'' +
                ", toolbox_name='" + toolbox_name + '\'' +
                '}';
    }
}
